package it.asvp.asvp_portal.data.entity.library;

import it.asvp.asvp_portal.data.entity.domain.BaseEntity;
import it.asvp.asvp_portal.data.entity.member.Member;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@SuppressWarnings("serial")
@Entity
@Table(name = "library_comment", catalog = "asvp_db")
public class LibraryComment extends BaseEntity {

  @ManyToOne(fetch = FetchType.EAGER)
  @JoinColumn(name = "id_member", nullable = false)
  private Member  member;

  @ManyToOne(fetch = FetchType.EAGER)
  @JoinColumn(name = "id_library", nullable = false)
  private Library library;

  @Column(name = "text", nullable = false, length = 1000)
  private String  text;

  public LibraryComment() {
  }

  public LibraryComment(Member member, Library library, String text, Date createdOn, Date lastUpdate) {
    this.member = member;
    this.library = library;
    this.text = text;
    this.createdOn = createdOn;
    this.lastUpdate = lastUpdate;
  }

  public Member getMember() {
    return this.member;
  }

  public void setMember(Member member) {
    this.member = member;
  }

  public Library getLibrary() {
    return this.library;
  }

  public void setLibrary(Library library) {
    this.library = library;
  }

  public String getText() {
    return this.text;
  }

  public void setText(String text) {
    this.text = text;
  }

}
